<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@include file="../../tld.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>提交订单</title>
<meta
	content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"
	name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<!-- 引入公用样式 -->
<link rel="stylesheet" href="../../../static/sass/common/ydui.css" />
<link rel="stylesheet" href="../../../static/stylesheets/user/order.css" />
<!-- 引入自适应解决方案类库 -->
<script src="../../../static/scripts/libs/ydui.flexible.js"></script>
</head>
<body>
	<div class="g-flexview">
		<!-- 主体内容开始 -->
		<section class="content_box">
			<!-- 未选地址 -->
			<c:if test="${address.id == null}">
				<div class="m-cell">
					<a class="cell-item"
						href="${base}/address/index?uid=${uid}&cartIds=${cartIds}&backFlag=2">
						<div class="cell-left">请填写收货地址</div>
						<div class="cell-right cell-arrow"></div>
					</a>
				</div>
			</c:if>
			<c:if test="${address.id != null}">
				<div class="m-cell">
					<div class="m-cell my_address">
						<a class="cell-item"
							href="${base}/address/index?uid=${uid}&cartIds=${cartIds}&backFlag=2">
							<div class="cell-left address_left">
								<p>
									<span>收货人：</span> <span>${address.name }</span> <span>${address.mobile }</span>
								</p>
								<p>
									<span>收货地址：</span> <span>${address.preAddress}${address.address }</span>
								</p>
							</div>
							<div class="cell-right cell-arrow"></div>
						</a>
					</div>
				</div>
			</c:if>
			<!-- 已选地址 -->
			<!-- <div class="m-cell my_address">
                <div class="cell-item">
                    <div class="cell-left address_left">
                        <p>
                            <span>收货人：</span>
                            <span>徐丹妮</span>
                            <span>15500009999</span>
                        </p>
                        <p>
                            <span>收货地址：</span>
                            <span>北京市北京市海淀区ss家园22号楼4单元北京市北京市海淀区ss家园22号楼4单元</span>
                        </p>
                    </div>
                    <div class="cell-right cell-arrow"></div>
                </div>
            </div> -->

			<!-- 订单列表 -->
			<div class="order_list">
				<!-- title -->
				<div class="m-cell mb_0">
					<div class="cell-item">
						<div class="cell-left gray">购物清单</div>
						<div class="cell-right"></div>
					</div>
				</div>
				<!-- list -->
				<article class="m-list list-theme4 lists">
					<c:if test="${fn:length(goodslist) > 0}">
						<c:forEach items="${goodslist}" var="item" varStatus="vs">
							<a href="#" class="list-item">
								<div class="list-img">
									<img src="${baseImgUrl}${item.goods.image }">
								</div>
								<div class="list-mes detail">
									<h3 class="list-title">${item.goods.name }</h3>
									<div class="list-mes-item disc">
										<div>
											<span class="list-price"><em>¥</em> <c:if
													test="${item.buytype == 0 }">
                                    ${item.goods.singleDiscount}
                                	</c:if> <c:if test="${item.buytype == 1 }">
                                    ${item.goods.fullDiscount}
                                    </c:if> </span> <span class="list-del-price">¥
												<c:if test="${item.buytype == 0 }">
                                    ${item.goods.singleUnitPrice}
                                	</c:if> <c:if test="${item.buytype == 1 }">
                                    ${item.goods.fullUnitPrice}
                                    </c:if>
											</span>
										</div>
										<div>x${item.buyNum }</div>
									</div>
								</div>
							</a>
						</c:forEach>
					</c:if>
					<%-- <a href="#" class="list-item">
						<div class="list-img">
							<img src="${baseImgUrl}${goods.image }">
						</div>
						<div class="list-mes detail">
							<h3 class="list-title">${goods.name }</h3>
							<div class="list-mes-item disc">
								<div>
									<span class="list-price"><em>¥</em> <c:if
											test="${buytype == 0 }">
                                    ${goods.singleDiscount}
                                	</c:if> <c:if test="${buytype == 1 }">
                                    ${goods.fullDiscount}
                                    </c:if> </span> <span class="list-del-price">¥
										<c:if test="${buytype == 0 }">
                                    ${goods.singleUnitPrice}
                                	</c:if> <c:if test="${buytype == 1 }">
                                    ${goods.fullUnitPrice}
                                    </c:if>
									</span>
								</div>
								<div>x${buyNum }</div>
							</div>
						</div>
					</a> --%>
					<!-- <a href="#" class="list-item">
                            <div class="list-img">
                                <img src="http://img1.shikee.com/try/2016/06/19/09430120929215230041.jpg_220x220.jpg">
                            </div>
                            <div class="list-mes">
                                <h3 class="list-title">标题标题标题标题标题</h3>
                                <div class="list-mes-item">
                                    <div>
                                        <span class="list-price"><em>¥</em>34.7</span>
                                        <span class="list-del-price">¥45.65</span>
                                    </div>
                                    <div>x1</div>
                                </div>
                            </div>
                        </a> -->
				</article>

				<div class="m-cell">
					<div class="cell-item">
						<div class="cell-left">配送方式：</div>
						<div class="cell-right">
							<p style="width: 100%; text-align: left; font-size: .3rem;">
								<c:if test="${freeExpress == 0 }">
                        	普通快递
                        	</c:if>
								<c:if test="${freeExpress == 1 }">
                        	免邮
                        	</c:if>
							</p>
						</div>
					</div>
					<div class="cell-item">
						<div class="cell-left">买家留言：</div>
						<div class="cell-right">
							<input type="text" class="cell-input" placeholder="(选填：对本次交易的说明)"
								autocomplete="off" />
						</div>
					</div>
					<div class="cell-item" style="height: 55px;">
						<p
							style="width: 100%; line-height: 55px; text-align: center; font-size: .3rem;">
							共${buyNum }件商品 合计：<span style="color: #dc1210;">￥${payCash }</span>
							<c:if test="${freeExpress == 0 }">
                        	(含运费：${express })
                       	</c:if>
							<c:if test="${freeExpress == 1 }">
                        	(含运费：0.00)
                       	</c:if>
						</p>
					</div>
				</div>

			</div>
		</section>

		<div class="btn_box">
			<a href='javascript:;' class="btn btn-primary">提交订单</a>
			<p>
				实付：<span>￥${payCash }</span>
			</p>
		</div>
	</div>
	<!-- 引入jQuery 2.0+ -->
	<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
	<!-- 引入YDUI脚本 -->
	<script src="../../../static/scripts/libs/ydui.citys.js"></script>
	<script src="../../../static/scripts/libs/ydui.js"></script>
	<script>
		$(document)
				.on(
						'click',
						'.btn-primary',
						function() {
							var url = '${base}/order/addcartorder?cartIds=${cartIds}&userId=${uid}&addressId=${address.id}&remark='
									+ $(".cell-input").val();
							//ajax提交
							$.ajax({
								type : 'GET',
								url : url,
								dataType : 'json',
								success : function(resp) {
									if(resp.code == 0){
										alert("提交订单成功");
									}else{
										alert(resp.msg);
									}
								},
								error : function(xhr, type) {
									alert('Ajax error!');
									// 即使加载出错，也得重置
								}
							});
						})
	</script>
</body>

</html>
